use ::libc;
extern "C" {
    fn strrchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char;
    fn vsnprintf(
        _: *mut libc::c_char,
        _: libc::c_ulong,
        _: *const libc::c_char,
        _: ::core::ffi::VaList,
    ) -> libc::c_int;
    fn snprintf(
        _: *mut libc::c_char,
        _: libc::c_ulong,
        _: *const libc::c_char,
        _: ...
    ) -> libc::c_int;
    fn getprogname() -> *const libc::c_char;
    fn prctl(__option: libc::c_int, _: ...) -> libc::c_int;
}
pub type __builtin_va_list = [__va_list_tag; 1];
#[derive(Copy, Clone)]
#[repr(C)]
pub struct __va_list_tag {
    pub gp_offset: libc::c_uint,
    pub fp_offset: libc::c_uint,
    pub overflow_arg_area: *mut libc::c_void,
    pub reg_save_area: *mut libc::c_void,
}
pub type va_list = __builtin_va_list;
#[no_mangle]
pub unsafe extern "C" fn setproctitle(mut fmt: *const libc::c_char, mut args: ...) {
    let mut title: [libc::c_char; 16] = [0; 16];
    let mut name: [libc::c_char; 16] = [0; 16];
    let mut cp: *mut libc::c_char = std::ptr::null_mut::<libc::c_char>();
    let mut ap: ::core::ffi::VaListImpl;
    let mut used: libc::c_int = 0;
    ap = args.clone();
    vsnprintf(
        title.as_mut_ptr(),
        ::core::mem::size_of::<[libc::c_char; 16]>() as libc::c_ulong,
        fmt,
        ap.as_va_list(),
    );
    used = snprintf(
        name.as_mut_ptr(),
        ::core::mem::size_of::<[libc::c_char; 16]>() as libc::c_ulong,
        b"%s: %s\0" as *const u8 as *const libc::c_char,
        getprogname(),
        title.as_mut_ptr(),
    );
    if used >= ::core::mem::size_of::<[libc::c_char; 16]>() as libc::c_ulong as libc::c_int {
        cp = strrchr(name.as_mut_ptr(), ' ' as i32);
        if !cp.is_null() {
            *cp = '\0' as i32 as libc::c_char;
        }
    }
    prctl(15 as libc::c_int, name.as_mut_ptr());
}
